package com.yzp;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Description
 *
 * @className: AppOrderService
 * @author: yanzhouping
 * @date: 2019/9/20 20:11
 */
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableSwagger2
public class AppOrderService {
    public static void main(String[] args) {
        SpringApplication.run(AppOrderService.class);
        /**
         * 如果使用rest方式以别名方式进行调用，依赖ribbon负载均衡器器 @LoadBalanced
         * @LoadBalanced 就能让这个RestTemplate在请求时拥有客户端负载均衡的能力
         */
    }

    /**
     * 创建 RestTemplate
     * @return
     */
    @Bean
//    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
